package com.hlk.admin;

import com.hlk.pojo.bo.AdminLoginBO;
import com.hlk.pojo.bo.NewAdminBO;
import com.hlk.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author hlk
 * @version 1.0
 * @date 2020-12-23 8:47
 */
@Api(value = "管理员admin维护", tags = {"管理员admin维护"})
@RequestMapping("adminMng")
public interface AdminControllerApi {

    @PostMapping("/adminLogin")
    Result adminLogin(@RequestBody AdminLoginBO adminLoginBO, HttpServletRequest request, HttpServletResponse response, BindingResult result);

    @ApiOperation(value = "查询admin用户名是否存在")
    @PostMapping("/adminIsExist")
    Result adminIsExist(@RequestParam String username);

    @ApiOperation(value = "创建admin")
    @PostMapping("/addNewAdmin")
    Result addNewAdmin(@RequestBody NewAdminBO newAdminBO, HttpServletRequest request, HttpServletResponse response, BindingResult result);

    @ApiOperation(value = "查询admin列表")
    @PostMapping("/getAdminList")
    Result getAdminList(@ApiParam(name = "page", value = "查询下一页的第几页", required = false)
                        @RequestParam Integer page,
                        @ApiParam(name = "pageSize", value = "分页查询每一页显示的条数", required = false)
                        @RequestParam Integer pageSize);

    @ApiOperation(value = "admin退出登录")
    @PostMapping("/adminLogout")
    public Result adminLogout(@RequestParam String adminId, HttpServletRequest request, HttpServletResponse response);

}
